<template>
	<view class="EarGrindingRead">
		<CardAudio ref="audio" :list="value.list"></CardAudio>
	</view>
</template>

<script>
	import CardAudio from '@/plugin/card_audio.vue';


	import * as api from '@/api/EarGrindingRead/index.js'
	export default {
		components: {
			CardAudio
		},
		data() {
			return {
				id: null,
				value: {
                   list:[]
				},
			}
		},
		onLoad(options) {
			if (options.id) {
				this.id = options.id;
				this.getPageFn();
			}
		},
		onHide() {
			this.hideAndUnloadFn();
		},
		onUnload() {
			this.hideAndUnloadFn();
		},
		methods: {
			// 页面销毁
			hideAndUnloadFn(){
				let audio=this.$refs.audio;
				if(audio){
					audio.hideAndUnloadFn && audio.hideAndUnloadFn();
				}
			},
			// 获取列表内容
			async getPageFn() {
				let res = await api.listenList(this.id);
				if (res.code === 0) {
					uni.setNavigationBarTitle({
						title: res.data.name
					})
					this.value = res.data;
				}
			}
		},
	}
</script>

<style>
</style>